<template>
  <div class="DecRoot">
    <el-card class="box-card">
      <div class="headerBox">
        <div class="leftBox" style="margin-bottom: 20px">会员管理</div>
        <!-- <el-button
            type="primary"
            icon="el-icon-plus"
            @click="dialogVisible = true"
            plain
            >批量审核</el-button
          > -->
      </div>
      <div class="search">
        <el-form :inline="true">
          <el-form-item label="账号类别">
            <el-select v-model="ipageCofig.type" placeholder="">
              <el-option label="全部" value=" "></el-option>
              <el-option label="采购商" :value="0"></el-option>
              <el-option label="供应商" :value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="手机号">
            <el-input v-model="ipageCofig.phone"></el-input>
          </el-form-item>
          <el-button
            size="small"
            style="margin-top: 3px"
            type="primary"
            @click="getList()"
            >查询</el-button
          >
        </el-form>
      </div>
    </el-card>
    <el-card class="box-card newCard">
      <el-table
        :data="tableData"
        style="width: 100%"
        height="62vh"
        header-cell-class-name="tableHeader"
        stripe
      >
        <el-table-column label="序号" type="index" width="50">
        </el-table-column>
        <el-table-column prop="phone" label="注册手机号"> </el-table-column>
        <el-table-column prop="phone" label="账号类别">
          <template slot-scope="scope">
            {{ scope.row.isStore ? "供应商" : "采购商" }}
          </template>
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间"> </el-table-column>

        <el-table-column prop="address" label="操作" width="100">
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="dark"
              content="详情"
              placement="top"
            >
              <img
                src="@/assets/image/icon/details.png"
                @click="editChange(scope.row)"
                class="iconImg"
                alt=""
              />
            </el-tooltip>
            <el-popconfirm
              title="确定要注销该账户吗？"
              @confirm="writeOffAdminMember(scope.row)"
            >
              <!-- <el-button slot="reference">

              </el-button> -->
              <template slot="reference">
                <i
                  class="el-icon-delete"
                  style="font-size: 25px; color: #409eff; cursor: pointer"
                ></i>
              </template>
            </el-popconfirm>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <div></div>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="ipageCofig.pageSize"
          :current-page.sync="ipageCofig.pageNumber"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-card>
    <el-dialog :visible.sync="dialogVisible" width="500" class="newDialog">
      <div class="DiaLogHeader">
        <div class="titlebOX">详情</div>
        <div class="chahao" @click="dialogVisible = false">
          <i class="el-icon-close"></i>
        </div>
      </div>
      <el-divider></el-divider>
      <div style="padding: 20px 40px">
        <el-form ref="form" :model="form" label-width="auto">
          <el-form-item label="注册手机号："> {{ rowData.phone }}</el-form-item>
          <el-form-item label="昵称："> {{ rowData.nickname }}</el-form-item>
          <el-form-item label="微信：" v-if="rowData.isStore">
            {{ rowData.vxNumber }}</el-form-item
          >
          <!-- <el-form-item label="QQ号："> {{ rowData.qqNumber }}</el-form-item> -->
          <el-form-item label="邮箱：" v-if="rowData.isStore">
            {{ rowData.storeEmail }}</el-form-item
          >
        </el-form>
      </div>
      <div class="btnBox">
        <el-button @click="dialogVisible = false"> 取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
    
    <script>
import ckeditor4 from "@/components/ckeditor4";
import {
  selectAdminMemberPage,
  selectAdminMemberInfoById,
  writeOffAdminMember,
} from "@/api/MembershipManagement";
import Moment from "moment";

export default {
  components: { ckeditor4 },
  name: "helpCenter",
  data() {
    return {
      form:{},
      rowData: {},
      dialogVisible: false,
      ipageCofig: {
        pageNumber: 1,
        pageSize: 10,
        phone: "",
        type: " ",
      },
      tableData: [],
      total: null,
      rowData: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //注销账号
    async writeOffAdminMember(row) {
      const params = {
        id: row.id,
      };
      const { data, code } = await writeOffAdminMember(params);
      if (data) {
        if (code == 200) {
          this.$message({
            message: "注销成功",
            type: "success",
          });
        }
        this.getList();
      }
    },
    editChange(row) {
      selectAdminMemberInfoById({
        id: row.id,
      }).then((data) => {
        this.rowData = data.data;
        this.dialogVisible = true;
      });
    },
    //获取列表
    getList() {
      selectAdminMemberPage(this.ipageCofig).then((data) => {
        this.tableData = data.data.records;
        this.total = data.data.total;
      });
    },
    handleSizeChange(val) {
      this.ipageCofig.pageSize = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.ipageCofig.pageNumber = val;
      this.getList();
    },
  },
};
</script>
    
    <style scoped lang="scss">
.btnBox {
  display: flex;
  justify-content: center;
  background: #fff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 10px 0;

  .btnImg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
  }
}

.DecRoot {
  padding: 20px;
  padding-left: 5px;
  padding-bottom: 0;

  .newCard {
    height: 70vh;
    margin-top: 20px;
  }

  /deep/ .el-button {
    padding: 9px 15px;
  }

  .el-card {
    .headerBox {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .leftBox {
        display: flex;
        align-items: center;
        font-size: 18px;
        font-weight: 700;

        /deep/ .el-form-item {
          margin-bottom: 0;
        }

        /deep/ .el-input--suffix {
          width: 200px;
        }
      }
    }

    /deep/ .tableHeader {
      background: #edf3ff;
      font-weight: 700;
      color: #666666;
    }

    .iconImg {
      width: 20px;
      height: 20px;
      cursor: pointer;
      margin-right: 10px;
    }

    .pagination {
      display: flex;
      justify-content: space-between;
      margin-top: 10px;

      /deep/ .el-pagination__editor.el-input .el-input__inner {
        height: 28px !important;
      }

      /deep/ .el-input--mini .el-input__inner {
        height: 28px !important;
      }
    }
  }
}
</style>
      <style scoped lang="scss">
.search {
  display: flex;
}
.newDialog {
  /deep/ .el-divider {
    margin: 0px;
  }
  /deep/ .el-dialog__header {
    padding: 0;
  }
  /deep/ .el-form-item__content {
    width: 75%;
  }
  /deep/ .el-select {
    width: 100%;
  }
  /deep/ .tableHeader {
    background: #edf3ff;
    font-weight: 700;
    color: #666666;
    padding: 5px 0;
  }
  .btnBox {
    display: flex;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 10px 0;
    .btnImg {
      width: 14px;
      height: 14px;
      vertical-align: middle;
    }
    /deep/ .el-button {
      padding: 10px 20px;
    }
  }
  .DiaLogHeader {
    display: flex;
    padding: 10px 20px;
    justify-content: space-between;
    .titlebOX {
      font-size: 16px;
      font-weight: 700;
    }
    .chahao {
      width: 20px;
      height: 20px;
      background-image: url("@/assets/image/icon/chahao.png");
      background-size: 100% 100%;
      text-align: center;
      line-height: 20px;
      color: #e65f00;
      cursor: pointer;
    }
  }
  /deep/ .el-input {
    width: 100% !important;
  }
}
/deep/ .el-dialog__header {
  font-weight: 700;
}
/deep/ .demo-ruleForm {
  padding: 10px;
}

/deep/ .el-form-item {
  margin-bottom: 8px;
}
/deep/ .el-form-item__error {
  z-index: 99;
}
/deep/ .el-dialog__body {
  padding: 0;
  padding-top: 10px;
  padding-bottom: 60px;
}
.dialogTextBox {
  font-size: 14px;
  color: #000000;
}
</style>
    